home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / batches / renAlias.bat < prev    next >
DOS Batch File  |  1994-07-04  |  1KB  |  38 lines

  1. @echo off
  2. ! renAlias.bat
  3. ! This batch file removes from all files in the current directory the ending " alias"
  4. !
  5.     ! prepare a file with the list of all file names which end with " alias"
  6.     dir/a-d/b "* alias" > renAlias_fileList
  7.  
  8.     ! open the list of names for reading
  9.     open renAlias_fileList renAlias_fileID
  10.  
  11.     ! read one line (ie. one name) at a time until the end of file is reached
  12.     onerror done
  13.     repeat loop
  14.  
  15.         ! read one name into the variable oldName
  16.         read %reAlias_fileID% renAlias_oldName
  17.  
  18.         ! remove the double quotes that DIR put at each end of the file name
  19.         decr -renAlias_oldName
  20.         decr renAlias_oldName
  21.  
  22.         ! make a copy of the name and remove from it the word " alias"
  23.         set renAlias_newName=%renAlias_oldName%
  24.         decr renAlias_newName by " alias"
  25.  
  26.         ! finally, do the actual renaming
  27.         ren %renAlias_oldName% %renAlias_newName%
  28.     :loop
  29.  
  30. :done
  31.  
  32.     ! clean up before terminating
  33.     close %renAlias_fileID%
  34.     del renAlias_fileList
  35.     set renAlias_fileID=
  36.     set renAlias_oldName=
  37.     set renAlias_newName=
  38.